package general.service;

import general.mapper.TestMapper;
import general.servlet.ServletLoadStart;
import org.apache.ibatis.session.SqlSession;

import java.util.Map;

/**
 * @desc 描述
 * create on 2018/10/26 by watson
 */
public class TestService {
    public static TestService me = new TestService();
    private TestService(){}

    public String getById(Integer id){
        String result;
        SqlSession session = ServletLoadStart.sqlSessionFactory.openSession();
        try {
            TestMapper mapper = session.getMapper(TestMapper.class);
            Map map = mapper.getById(id);
            result = map.toString();
        } catch (Exception e) {
            result = "400:"+e.getMessage();
        } finally {
            session.close();
        }
        return result;
    }

}
